<?php
class BulletinAction extends BaseAction
{
    public function _initialize()
    {
        $this->assign('o_nav', 3);
        parent::_initialize();
    }

    /**
     * 公告列表
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function index()
    {
        $Page = new Page(D('Bulletin')->count(), 18);
        $rs = D('Bulletin')->field('id,title,create_time')
            ->limit($Page->firstRow . ',' . $Page->listRows)
            ->order('create_time DESC')
            ->select();
        $this->assign('bs', $rs);
        $this->assign('page', $Page->show());
        $this->display();
    }

    /**
     * 公告详细
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function detail()
    {
        $id = intval($this->_get('id'));
        if (!$id) {
            $this->error('提供公告获取信息不对！');
        }
        $b = M('Bulletin')->find($id);
        if (!$b) {
            $this->error('公告不存在！');
        }
        $this->seoSet($b['title'], $b['title'], msubstr(hh($b['content']), 0, 200));
        $this->assign('b', $b);
        $this->display();
    }

}

?>